
%%% Weighting the Evidence: A Rank-Dependent Model of Outdoor Recreation, June 2024
%%% This file generates catch-per-trip distributions for each species and year in 2010-2022, using the uncertainty of the estimates from MRIP 

tic;

%Summer flounder
SFdata2010=importdata('FlukeCatchPerTrip2010.txt');
SFdata2011=importdata('FlukeCatchPerTrip2011.txt');
SFdata2012=importdata('FlukeCatchPerTrip2012.txt');
SFdata2013=importdata('FlukeCatchPerTrip2013.txt');
SFdata2014=importdata('FlukeCatchPerTrip2014.txt');
SFdata2015=importdata('FlukeCatchPerTrip2015.txt');
SFdata2016=importdata('FlukeCatchPerTrip2016.txt');
SFdata2017=importdata('FlukeCatchPerTrip2017.txt');
SFdata2018=importdata('FlukeCatchPerTrip2018.txt');
SFdata2019=importdata('FlukeCatchPerTrip2019.txt');
SFdata2020=importdata('FlukeCatchPerTrip2020.txt');
SFdata2021=importdata('FlukeCatchPerTrip2021.txt');
SFdata2022=importdata('FlukeCatchPerTrip2022.txt');

%Scup
Sdata2010=importdata('ScupCatchPerTrip2010.txt'); 
Sdata2011=importdata('ScupCatchPerTrip2011.txt'); 
Sdata2012=importdata('ScupCatchPerTrip2012.txt'); 
Sdata2013=importdata('ScupCatchPerTrip2013.txt'); 
Sdata2014=importdata('ScupCatchPerTrip2014.txt'); 
Sdata2015=importdata('ScupCatchPerTrip2015.txt'); 
Sdata2016=importdata('ScupCatchPerTrip2016.txt'); 
Sdata2017=importdata('ScupCatchPerTrip2017.txt'); 
Sdata2018=importdata('ScupCatchPerTrip2018.txt'); 
Sdata2019=importdata('ScupCatchPerTrip2019.txt'); 
Sdata2020=importdata('ScupCatchPerTrip2020.txt'); 
Sdata2021=importdata('ScupCatchPerTrip2021.txt'); 
Sdata2022=importdata('ScupCatchPerTrip2022.txt'); 

%Black sea bass
BSBdata2010=importdata('BSBCatchPerTrip2010.txt'); 
BSBdata2011=importdata('BSBCatchPerTrip2011.txt'); 
BSBdata2012=importdata('BSBCatchPerTrip2012.txt'); 
BSBdata2013=importdata('BSBCatchPerTrip2013.txt'); 
BSBdata2014=importdata('BSBCatchPerTrip2014.txt'); 
BSBdata2015=importdata('BSBCatchPerTrip2015.txt'); 
BSBdata2016=importdata('BSBCatchPerTrip2016.txt'); 
BSBdata2017=importdata('BSBCatchPerTrip2017.txt'); 
BSBdata2018=importdata('BSBCatchPerTrip2018.txt'); 
BSBdata2019=importdata('BSBCatchPerTrip2019.txt'); 
BSBdata2020=importdata('BSBCatchPerTrip2020.txt'); 
BSBdata2021=importdata('BSBCatchPerTrip2021.txt');
BSBdata2022=importdata('BSBCatchPerTrip2022.txt');

%Main parameters
N=30;
M=25000;
T=100;

SFreshaffle2010=CatchTripDistribution(N,M,T,SFdata2010.data);
SFreshaffle2011=CatchTripDistribution(N,M,T,SFdata2011.data);
SFreshaffle2012=CatchTripDistribution(N,M,T,SFdata2012.data);
SFreshaffle2013=CatchTripDistribution(N,M,T,SFdata2013.data);
SFreshaffle2014=CatchTripDistribution(N,M,T,SFdata2014.data);
SFreshaffle2015=CatchTripDistribution(N,M,T,SFdata2015.data);
SFreshaffle2016=CatchTripDistribution(N,M,T,SFdata2016.data);
SFreshaffle2017=CatchTripDistribution(N,M,T,SFdata2017.data);
SFreshaffle2018=CatchTripDistribution(N,M,T,SFdata2018.data);
SFreshaffle2019=CatchTripDistribution(N,M,T,SFdata2019.data);
SFreshaffle2020=CatchTripDistribution(N,M,T,SFdata2020.data);
SFreshaffle2021=CatchTripDistribution(N,M,T,SFdata2021.data);
SFreshaffle2022=CatchTripDistribution(N,M,T,SFdata2022.data);

Sreshaffle2010=CatchTripDistribution(N,M,T,Sdata2010.data);
Sreshaffle2011=CatchTripDistribution(N,M,T,Sdata2011.data);
Sreshaffle2012=CatchTripDistribution(N,M,T,Sdata2012.data);
Sreshaffle2013=CatchTripDistribution(N,M,T,Sdata2013.data);
Sreshaffle2014=CatchTripDistribution(N,M,T,Sdata2014.data);
Sreshaffle2015=CatchTripDistribution(N,M,T,Sdata2015.data);
Sreshaffle2016=CatchTripDistribution(N,M,T,Sdata2016.data);
Sreshaffle2017=CatchTripDistribution(N,M,T,Sdata2017.data);
Sreshaffle2018=CatchTripDistribution(N,M,T,Sdata2018.data);
Sreshaffle2019=CatchTripDistribution(N,M,T,Sdata2019.data);
Sreshaffle2020=CatchTripDistribution(N,M,T,Sdata2020.data);
Sreshaffle2021=CatchTripDistribution(N,M,T,Sdata2021.data);
Sreshaffle2022=CatchTripDistribution(N,M,T,Sdata2022.data);

BSBreshaffle2010=CatchTripDistribution(N,M,T,BSBdata2010.data);
BSBreshaffle2011=CatchTripDistribution(N,M,T,BSBdata2011.data);
BSBreshaffle2012=CatchTripDistribution(N,M,T,BSBdata2012.data);
BSBreshaffle2013=CatchTripDistribution(N,M,T,BSBdata2013.data);
BSBreshaffle2014=CatchTripDistribution(N,M,T,BSBdata2014.data);
BSBreshaffle2015=CatchTripDistribution(N,M,T,BSBdata2015.data);
BSBreshaffle2016=CatchTripDistribution(N,M,T,BSBdata2016.data);
BSBreshaffle2017=CatchTripDistribution(N,M,T,BSBdata2017.data);
BSBreshaffle2018=CatchTripDistribution(N,M,T,BSBdata2018.data);
BSBreshaffle2019=CatchTripDistribution(N,M,T,BSBdata2019.data);
BSBreshaffle2020=CatchTripDistribution(N,M,T,BSBdata2020.data);
BSBreshaffle2021=CatchTripDistribution(N,M,T,BSBdata2021.data);
BSBreshaffle2022=CatchTripDistribution(N,M,T,BSBdata2022.data);

clearvars SFdata2009 SFdata2010 SFdata2011 SFdata2012 SFdata2013 SFdata2014 SFdata2015 SFdata2016 SFdata2017 SFdata2018 SFdata2019 SFdata2020
clearvars Sdata2009 Sdata2010 Sdata2011 Sdata2012 Sdata2013 Sdata2014 Sdata2015 Sdata2016 Sdata2017 Sdata2018 Sdata2019 Sdata2020
clearvars BSBdata2009 BSBdata2010 BSBdata2011 BSBdata2012 BSBdata2013 BSBdata2014 BSBdata2015 BSBdata2016 BSBdata2017 BSBdata2018 BSBdata2019 BSBdata2020


%Saving the output
save('CatchPerTrip2010','SFreshaffle2010','Sreshaffle2010','BSBreshaffle2010');
clearvars Sreshaffle2010 BSBreshaffle2010 SFreshaffle2010
save('CatchPerTrip2011','SFreshaffle2011','Sreshaffle2011','BSBreshaffle2011');
clearvars Sreshaffle2011 BSBreshaffle2011 SFreshaffle2011
save('CatchPerTrip2012','SFreshaffle2012','Sreshaffle2012','BSBreshaffle2012');
clearvars Sreshaffle2012 BSBreshaffle2012 SFreshaffle2012
save('CatchPerTrip2013','SFreshaffle2013','Sreshaffle2013','BSBreshaffle2013');
clearvars Sreshaffle2013 BSBreshaffle2013 SFreshaffle2013
save('CatchPerTrip2014','SFreshaffle2014','Sreshaffle2014','BSBreshaffle2014');
clearvars Sreshaffle2014 BSBreshaffle2014 SFreshaffle2014
save('CatchPerTrip2015','SFreshaffle2015','Sreshaffle2015','BSBreshaffle2015');
clearvars Sreshaffle2015 BSBreshaffle2015 SFreshaffle2015
save('CatchPerTrip2016','SFreshaffle2016','Sreshaffle2016','BSBreshaffle2016');
clearvars Sreshaffle2016 BSBreshaffle2016 SFreshaffle2016
save('CatchPerTrip2017','SFreshaffle2017','Sreshaffle2017','BSBreshaffle2017');
clearvars  Sreshaffle2017 BSBreshaffle2017 SFreshaffle2017
save('CatchPerTrip2018','SFreshaffle2018','Sreshaffle2018','BSBreshaffle2018');
clearvars Sreshaffle2018 BSBreshaffle2018 SFreshaffle2018
save('CatchPerTrip2019','SFreshaffle2019','Sreshaffle2019','BSBreshaffle2019');
clearvars Sreshaffle2019 BSBreshaffle2019 SFreshaffle2019
save('CatchPerTrip2020','SFreshaffle2020','Sreshaffle2020','BSBreshaffle2020');
clearvars Sreshaffle2020 BSBreshaffle2020 SFreshaffle2020
save('CatchPerTrip2021','SFreshaffle2021','Sreshaffle2021','BSBreshaffle2021');
clearvars Sreshaffle2021 BSBreshaffle2021 SFreshaffle2021
save('CatchPerTrip2022','SFreshaffle2022','Sreshaffle2022','BSBreshaffle2022');
clearvars Sreshaffle2022 BSBreshaffle2022 SFreshaffle2022

toc;